package com.jy.adscm.hcPlan.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.hcPlan.bean.HcPlanMakePartMateriel;
import com.jy.adscm.hcPlan.bean.Hc_plan_materiel;
import com.jy.adscm.hcPlan.service.HcPlanMakePartMaterielService;
import com.jy.adscm.hcPlan.service.Hc_plan_materielService;
import com.jy.adscm.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 零件制造标所需物料标准配置 前端控制器
 * </p>
 *
 * @author yyy
 * @since 2018-09-04
 */
@RestController
@RequestMapping("/adscm/hcplan/hcPlanMakePartMateriel")
public class HcPlanMakePartMaterielController {

    @Autowired
    HcPlanMakePartMaterielService hcPlanMakePartMaterielService;
    @Autowired
    Hc_plan_materielService hc_plan_materielService;
    /**
     * 获取零件制造的所有物料
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/getPartMateriel")
    public SimpleCoreResponse getPartMateriel() throws AdscmSystemException {

        Wrapper<Hc_plan_materiel> wrapper = new EntityWrapper<>();
        wrapper.eq("use_type","零件制造物料");


        return new SimpleCoreResponse("200","查询成功",hc_plan_materielService.selectList(wrapper));
    }
    /**
     *  获取单次并单的物料其他标准时间配置
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/getMaterielOtherConfig")
    public SimpleCoreResponse getMaterielOtherConfig(String materiel_merge_id) throws AdscmSystemException {

        return new SimpleCoreResponse("200","获取单次并单的物料其他标准时间配置成功",hcPlanMakePartMaterielService.getMaterielOtherConfig(materiel_merge_id));
    }
}

